package com.king.photo.crop;

import android.app.Activity;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;

import com.king.photo.R;


public class CutActivity extends Activity implements View.OnClickListener {

    private MyImageView mImageView;
    public static Bitmap bitmap;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_cut);
        initView();
    }

    private void initView() {
        View back = findViewById(R.id.tv_left);
        View finish = findViewById(R.id.tv_right);
        back.setVisibility(View.VISIBLE);
        back.setOnClickListener(this);
        finish.setVisibility(View.VISIBLE);
        finish.setOnClickListener(this);
        mImageView = (MyImageView) findViewById(R.id.my_image_view);
        mImageView.setImageResource(R.drawable.demo2);
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_left:
                onBackPressed();
                break;
            case R.id.tv_right:
                bitmap = mImageView.clipImage();
                setResult(0);
                finish();
                break;
            default:
                break;
        }
    }
}
